package com.kaikai.educms.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kaikai.commonutils.R;
import com.kaikai.educms.entity.CrmBanner;
import com.kaikai.educms.service.CrmBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author yujiankai
 * @since 2021-05-26
 */
@RestController
@CrossOrigin
@RequestMapping("/educms/bannerfront")
public class BannerFrontController {
    @Autowired
   private CrmBannerService bannerService;
//    @GetMapping("{id}")
//    public R getBanner(@PathVariable String id){
//    List<CrmBanner> bannerList=bannerService.getBanners();
//    return R.ok().data("list",bannerList);
//}
    //根据id排序,获取前三条轮播图 select * from order by id desc limit 3


    @GetMapping("getAllBanners")
    public R getAllBanners(){
//         List<CrmBanner> banners = bannerService.list(null);
        List<CrmBanner> bannerList = bannerService.getBanners();
        return R.ok().data("list",bannerList);
    }
}

